home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-03-18 | 12.4 KB | 259 lines | [TEXT/MPS ] |
- /* These functions are generally found in an application that is using the
- ** application framework portion of DTS.Lib (DTS.framework). Most of these
- ** functions are called by the DTS.framework, and therefore must be included
- ** in your application. */
-
-
-
- /************** DoEvent.c **************/
-
- void DoEvent(EventRecord *event);
- /* You definitely want to modify this function. This is the main dispatcher for
- ** the application event loop. Change the code for the different cases as is
- ** appropriate for your application. */
-
- void DoActivate(WindowPtr window);
- /* • Called by DTS.framework. • */
- /* This function activates or deactivates the window, as appropriate. It changes
- ** the state of the window controls and grow icon. If there is anything else
- ** that needs to be done for your application's windows during activation or
- ** deactivation, then it needs to be done here. */
-
-
-
- /************** EventLoop.c **************/
-
- void EventLoop(void);
- /* This is the main application event loop. It simply calls WaitNextEvent
- ** and DoEvent until the user decides to quit. */
-
- void DoCursor(void);
- /* • Called by DTS.framework. • */
- /* Handle the cursor changes. Most of the work is done by the application
- ** framework. Each window has its own cursor calculation proc, so you
- ** shouldn't have to add any code here. You may wish to do some special
- ** stuff prior to the DoWindowCursor call if you have modeless dialogs. */
-
-
-
- /************** File.c **************/
-
- OSErr InitDocument(FileRecHndl frHndl);
- /* • Called by DTS.framework. • */
- /* This function is where you do the application specific document
- ** initialization things. This function is automatically called at
- ** appropriate times by DTS.framework. */
-
- long InitDocumentSize(OSType sftype);
- /* • Called by DTS.framework. • */
- /* This function is used to return the document size, given an OSType. */
-
-
-
- /************** Help.c **************/
-
- void DynamicBalloonHelp(void);
- /* This function is used to do balloon help for the content of a window. */
-
-
-
- /************** IdleTasks.c **************/
-
- void DoIdleTasks(EventRecord *event);
- /* If your application has an tasks that need to be done at idle time, this
- ** is the place to put them. It is automatically called at appropriate times
- ** by DTS.framework. */
-
-
-
- /************** Menu.c **************/
-
- void DoAdjustMenus(void);
- /* • Called by DTS.framework. • */
- /* This function is where your application would make menu changes, such as
- ** enabling or disabling menu choices, adding or removing menu items, etc. */
-
- void DoMenuCommand(long menuResult);
- /* This function is where your application would respond to menu commands. */
-
- Boolean DoAdjustFileMenu(WindowPtr window);
- /* This function shows the kind of stuff you do to adjust menu items. */
-
- Boolean DoAdjustEditMenu(WindowPtr window);
- /* This function shows the kind of stuff you do to adjust menu items. */
-
-
-
- /************** Window.c **************/
-
- void CalcFrameRgn(FileRecHndl frHndl, WindowPtr window, RgnHandle rgn);
- /* • Called by DTS.framework. • */
- /* This function is the default function for contributing to the frame calculation.
- ** DTS.framework document scrollbars and growIcon are contributed later automatically.
- ** Only if you have additional (or alternate) frame parts in your window should
- ** you add any code to this function. CalcFrameRgn is called by DoCalcFrameRgn
- ** unless you change the default frame region calculation procedure pointer.
- ** If you have no additional frame contribution, then you should simply return
- ** the region passed in unchanged. */
-
- void ContentClick(WindowPtr window, EventRecord *event, Boolean firstClick);
- /* • Called by DTS.framework. • */
- /* This function is the default function for handling click events for the window. */
-
- void ContentKey(WindowPtr window, EventRecord *event, Boolean *passThrough);
- /* • Called by DTS.framework. • */
- /* This function is the default function for handling key events for the window. */
-
- void DrawFrame(FileRecHndl frHndl, WindowPtr window);
- /* • Called by DTS.framework. • */
- /* This function is the default function for drawing the remainder of the
- ** frame. The DTS.framework document scrollbars and growIcon, if any, are already
- ** drawn. This function is called by DoDrawFrame unless you change the
- ** default frame drawing procedure pointer. */
-
- void FreeDocument(FileRecHndl frHndl);
- /* • Called by DTS.framework. • */
- /* This function is used to dispose of all allocated handles for the document. */
-
- OSErr FreeWindow(FileRecHndl frHndl, WindowPtr window);
- /* • Called by DTS.framework. • */
- /* This function is used to perform any additional tasks that need to be
- ** performed upon a window closing. */
-
- void ImageDocument(FileRecHndl frHndl);
- /* • Called by DTS.framework. • */
- /* This function is the default function for imaging the document into the
- ** window or into the printer port. It is called in response to update
- ** events, or in response to the user printing. You can change the imaging
- ** procedure pointer if you wish. This is only called as a default. */
-
- OSErr InitContent(FileRecHndl frHndl, WindowPtr window);
- /* • Called by DTS.framework. • */
- /* This function is the default function for initializing the content area
- ** of a window. It is called by DoNewWindow unless you change the default
- ** content initialization procedure pointer. */
-
- OSErr ReadDocument(FileRecHndl frHndl);
- /* • Called by DTS.framework. • */
- /* This function is called to read in the document into the designated
- ** file reference handle. If the file type is of the default type, then
- ** DefaultReadDocument and DefaultReadDocumentFixup can be called to
- ** read in the document. */
-
- void ResizeContent(WindowPtr window, short oldh, short oldv);
- /* • Called by DTS.framework. • */
- /* This function is the default function for resizing the document content.
- ** The application calls DoResizeWindow, which handles resizing the document
- ** scrollbars. It then calls the content resizing procedure. This function
- ** is called by DoResizeWindow unless you change the default content resizing
- ** procedure pointer. */
-
- void ScrollFrame(FileRecHndl frHndl, WindowPtr window);
- /* • Called by DTS.framework. • */
- /* This function is called after a scroll event. It is possible that any
- ** custom frames the application has need to be scrolled with the document.
- ** This is commonly the case for document rulers, and other such frame
- ** adornments. */
-
- void UndoFixup(FileRecHndl frHndl, Point contOrg, Boolean afterUndo);
- /* • Called by DTS.framework. • */
- /* This function is called to prepare for or clean up after an undo operation.
- ** If afterUndo is false, the undo operation hasn't started yet. You may want
- ** to do pre-undo operations such as deselect anything that is currently selected.
- ** When an undo occurs, you usually want to have selected what was undone so that
- ** the user can determine more easily what the undo actually did. This call is
- ** when such tasks would be done.
- ** Uf afterUndo is true, the undo operation has been completed. There may be
- ** clean up tasks you need to do at this time. You may simply need to redraw
- ** the document that was undone. Whatever clean up needs to occur, this is
- ** when it would be done. */
-
- Boolean WindowCursor(FileRecHndl frHndl, WindowPtr window, Point globalPt);
- /* • Called by DTS.framework. • */
- /* This function is where you adjust the cursor to reflect the location in the
- ** document or window. You have the additional input of gCursorRgn to deal
- ** with. The way that the cursor handling works is as follows:
- ** 1) The application calls DoWindowCursor().
- ** 2) DoWindowCursor() works its way through the windows, front to back. It
- ** looks at the document's windowCursorProc and checks to see if the document
- ** has one. If the document doesn't have one, then it assumes that that window
- ** always uses an arrow. If the cursor is over that window, the cursor is set
- ** to an arrow. If the cursor isn't over the window, then the next window is
- ** tried. If all documents don't have a windowCursorProc, then the cursor is
- ** set to an arrow.
- ** 3) If a document has a windowCursorProc, then the proc is called. The proc's
- ** job is as follows:
- ** a) If the cursor is over a position that is determined by the window, then
- ** the proc removes other areas from gCursorRgn. Note that it should not
- ** simply set the area to what it "thinks" is the correct area. This window
- ** may not be the front-most. Other windows will have already been subtracted
- ** from gCursorRgn. The resultant gCursorRgn is the correct cursor area,
- ** and should be passed to WaitNextEvent calls in the application. Also,
- ** the cursor should be set to the correct cursor, of course.
- ** You should also return true, as the cursor has been determined.
- ** b) If the cursor is not over a position for this window, then you should
- ** return. You will either pass back true or false. If you don't wish
- ** windows behind this window to have a shot at cursor determination, then
- ** return true. This states that the cursor is "determined". It is, in the
- ** sense that no further determination will occur. If you return false, then
- ** other windows get a shot at determining the cursor. */
-
-
-
- void WindowGoneFixup(WindowPtr window);
- /* • Called by DTS.framework. • */
- /* After the DTS.Lib framework disposes of a window, it calls here. This is
- ** to give the application a chance to do any additional tasks related to
- ** a window closing. For example: The window that was closed might be a
- ** modeless dialog. It has no related document, so just the dialog is
- ** closed by the framework. The modeless DialogPtr may have been kept in
- ** a global, which now needs to be set to nil. You could do that here.
- ** If the WindowPtr passed in is equal to the global DialogPtr, set the
- ** global DialogPtr to nil. */
-
- OSErr WriteDocument(FileRecHndl frHndl);
- /* • Called by DTS.framework. • */
- /* This function is called to write out the document from the designated
- ** file reference handle. If the file type is of the default type, then
- ** DefaultWriteDocument can be called to read in the document. */
-
- OSErr DoOpenApplication(void)
- /* • Called by DTS.framework. • */
- /* This function is in case you have unusual startup things you do to your app. AppsToGo
- ** effectively restarts the application it is editing when it is editing a running app.
- ** The application may need to be messaged about this, and so this function gets called.
- ** Note that this function gets called when the application normally starts up, as well. */
-
- Boolean AdjustMenuItems(WindowPtr window, short menuID)
- /* • Called by DTS.framework. • */
- /* The framework calls your application to adjust the menu items. At this point, the
- ** items have all been disabled. This means that your application only has to worry about
- ** enabling items. (Don't forget to enable quit!!) The framework calls this function for
- ** each item in the currently active 'MBAR' resource. You just do the right thing for the
- ** designated menu.
- ** The top window's document frHndl contains a procPtr to this function. If you change
- ** this procPtr, then you can cause a different AdjustMenuItems() function to be called
- ** for that document type. Your choice.
- ** The framework also has to adjust menus for the no-window case. In the no-window case
- ** this function is always called. */
-
- Boolean DoMenuItem(WindowPtr window, short menuID, short menuItem)
- /* • Called by DTS.framework. • */
- /* The framework calls your application to do the selected menu item. The framework calls
- ** this function when the user chose a menu item either by mouse or by command-key.
- ** The top window's document frHndl contains a procPtr to this function. If you change
- ** this procPtr, then you can cause a different DoMenuItem() function to be called
- ** for that document type. Your choice.
- ** The framework also has to handle the no-window case. In the no-window case
- ** this function is always called. */
-
-
- /* There are also two other files, WindowDialog.c, and WindowPalette.c. These files
- ** have very similar functions to this one. You can consider them parallel source files,
- ** but dispatching goes to the appropriate one, based on the document/window type
- ** (kwIsDocument, kwIsPalette, kwIsModalDialog). WindowPalette.c is missing the
- ** menu handling functions. It is assumed that the palette won't affect the state of
- ** the menus, and therefore the window behind it should actually be the determinator
- ** as to the adjustment and execution of the menu items. */
-
-